package cn.thornbird.orgsync.vo.record;

import cn.thornbird.orgsync.entity.Company;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

@Data
public class CompanyRecord extends Record<Company> {

    public static final String WEBSITE_REG_EXP = "^$|^http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?$";

    @NotBlank(message = "名称不能为空")
    @Size(max = 32, message = "名称长度不符合要求")
    private String name;

    @NotNull(message = "城市ID不能为空")
    @Size(max = 32, message = "城市ID长度不符合要求")
    private String cityId;

    @NotNull(message = "可用不能为空")
    private Boolean active;

    @Size(max = 128, message = "LOGO长度不符合要求")
    private String logo;

    @Size(max = 128, message = "地址长度不符合要求")
    private String address;

    @Pattern(regexp = WEBSITE_REG_EXP, message = "官网格式不正确")
    @Size(max = 64, message = "官网长度不符合要求")
    private String website;

    @Pattern(regexp = SimpleUserRecord.EMAIL_REG_EXP, message = "Email格式不正确")
    @Size(max = 64, message = "Email长度不符合要求")
    private String email;

    @Pattern(regexp = SimpleUserRecord.TELEPHONE_REG_EXP, message = "电话格式不正确")
    @Size(max = 32, message = "电话长度不符合要求")
    private String telephone;

    @Size(max = 256, message = "备注长度不符合要求")
    private String remark;

    private String logoId;

}
